const readFileRes=require('../utils/readFileRes')
let chooseFile={
  HtmlJsCss(req,res) {
    let rawPath=req.url;
    let suffix=req.url.split('.')[1];
    if (suffix=='js'){
      suffix='javascript'
    }
    readFileRes.reader(`./src${rawPath}`,res,'utf-8',{'content-type': `text/${suffix};charset=utf-8;`})
  },
  Image(req,res){
    let rawPath=req.url;
    let suffix=req.url.split('.')[1];
    readFileRes.reader(`./src${rawPath}`,res,'',{'content-type': `image/${suffix};`})
  }
};

module.exports= chooseFile;